package watercalc;

public class WaterCalc {

	static final int EXIT_SUCCESS = 0;
	static final int EXIT_FAILURE = 1;
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		long startTime = System.currentTimeMillis();
		
		Arguments.check(args);
		
		if (args[0] == Arguments.HELP)
			Arguments.exitDisplayHelp();
		
		Graph graph = Parser.parse(args[0]);
		graph.display(Graph.HEIGHTS);
		
		if (args.length == 2 && args[1] == Arguments.ADJACENCY8) {
			graph.buildAdjacencyLists(Arguments.ADJACENCY8);
		} else {
			graph.buildAdjacencyLists(Arguments.ADJACENCY4);
		}
		
		Solver.solve(graph);
		
		long endTime = System.currentTimeMillis();
		System.out.println("Done [Elapsed: " + ((endTime - startTime) / 1000.0) + "\"]");
		
	}

}
